Accusoft.FSInvoices1.Net
Load Image for Display

The ImageLoader class is provided to load files and retrieve the image for display. This class is capable of loading different image formats including multipage image formats. The image loader provides the same pre-processing functionality that is used during processing. To assure a "What you see is what you processed" environment, it is recommended that the image loader be used to retrieve images for display using the same option settings that was used in the image processing operation.

Available Pre-Processing options:

AutoBinarize When true, converts color images to bi-tonal (black and white) images. This can be set to false for displaying images in the original color.
DotShadeRemoval

When true, removes Dot shaded regions from the image. This option is normally false for display since it changes the image. 

 The image must be bi-tonal for this option's function. (i.e. It has to be used in conjunction with the AutoBinarize option).
Deskew

When true, pre-processing attempts to straighten the page so lines are horizontal. This option should normally be set true as any skew in the page decreases the OCR reading.

If this option is set to false when processing, it should also be set false for display.

Using the Image loader

Example
Copy Code
// Create an instance of the license class
using (Licensing license = new Licensing())
{
    license.SetSolutionName("YourSolutionName");
    license.SetSolutionKey(12345, 12345, 12345, 12345);
    license.SetOEMLicenseKey("2.0.AStringForOEMLicensingContactAccusoftSalesForMoreInformation…");
 
    // Create an instance of the image loader
    using (ImageLoader imageLoader = new ImageLoader(license))
    {
       // Load the file into the image loader
        imageLoader.LoadImage(fileName);
        // Get the image
        return imageLoader.ToHdib(true);
     }
 }

Setting the Pre-processing Options

Example
Copy Code
// Set the Preprocessing options
imageLoader.PreprocessingOptions.AutoBinarize = false;
imageLoader.PreprocessingOptions.DotShadingRemoval = false;
imageLoader.PreprocessingOptions.Deskew = true;

The number of pages in a file can be found in the PageCount property. Setting the page to render an image is done with the CurrentPage property.

Example
Copy Code
for (int pageNumber = 0; pageNumber < imageLoader.PageCount; pageNumber++)
{
    // Set the page to load
    imageLoader.CurrentPage = pageNumber;
    // Get the page as an hdib
    System.IntPtr hDib = imageLoader.ToHdib(true);
    // do something with the image
}


 

 


©2014. Accusoft Corporation. All Rights Reserved.

Send Feedback